//
//  CarInfo.swift
//
//  Created by 邱仙凯 on 2022/3/24
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

public struct ZyaCarInfo: Mappable,Codable {

  // MARK: Declaration for string constants to be used to decode and also serialize.
  private struct SerializationKeys {
    static let zDriverNm = "z_driver_nm"
    static let zStaffNm = "z_staff_nm"
    static let zCarNo = "z_car_no"
    static let idKey = "id_key"
    static let zBidId = "z_bid_id"
    static let zUpdateTm = "z_update_tm"
    static let zArriveTm = "z_arrive_tm"
    static let zCreateTm = "z_create_tm"
    static let zDriverTel = "z_driver_tel"
    static let zStaffId = "z_staff_id"
  }

  // MARK: Properties
  public var zDriverNm: String?
  public var zStaffNm: String?
  public var zCarNo: String?
  public var idKey: String?
  public var zBidId: String?
  public var zUpdateTm: String?
  public var zArriveTm: String?
  public var zCreateTm: String?
  public var zDriverTel: String?
  public var zStaffId: Int?
    public var openx = true

  // MARK: ObjectMapper Initializers
  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public init?(map: Map){

  }

  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public mutating func mapping(map: Map) {
    zDriverNm <- map[SerializationKeys.zDriverNm]
    zStaffNm <- map[SerializationKeys.zStaffNm]
    zCarNo <- map[SerializationKeys.zCarNo]
    idKey <- (map[SerializationKeys.idKey],StringTransform())
    zBidId <- (map[SerializationKeys.zBidId],StringTransform())
    zUpdateTm <- map[SerializationKeys.zUpdateTm]
    zArriveTm <- map[SerializationKeys.zArriveTm]
    zCreateTm <- map[SerializationKeys.zCreateTm]
    zDriverTel <- map[SerializationKeys.zDriverTel]
    zStaffId <- map[SerializationKeys.zStaffId]
  }

  /// Generates description of the object in the form of a NSDictionary.
  ///
  /// - returns: A Key value pair containing all valid values in the object.
  public func dictionaryRepresentation() -> [String: Any] {
    var dictionary: [String: Any] = [:]
    if let value = zDriverNm { dictionary[SerializationKeys.zDriverNm] = value }
    if let value = zStaffNm { dictionary[SerializationKeys.zStaffNm] = value }
    if let value = zCarNo { dictionary[SerializationKeys.zCarNo] = value }
      if let value = idKey { dictionary[SerializationKeys.idKey] = value } else {
          dictionary[SerializationKeys.idKey] = ""
      }
    if let value = zBidId { dictionary[SerializationKeys.zBidId] = value }
    if let value = zUpdateTm { dictionary[SerializationKeys.zUpdateTm] = value }
    if let value = zArriveTm { dictionary[SerializationKeys.zArriveTm] = value }
    if let value = zCreateTm { dictionary[SerializationKeys.zCreateTm] = value }
    if let value = zDriverTel { dictionary[SerializationKeys.zDriverTel] = value }
    if let value = zStaffId { dictionary[SerializationKeys.zStaffId] = value }
    return dictionary
  }

}
